#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>

typedef int datatype;
typedef struct Stack_List
{
	struct Stack_List* next;
	datatype data;
}SList;
void STackInit(SList** t)
{
	*t = NULL;
}
bool ST_Push(SList** t, datatype x)
{
	SList* newnode = (SList*)malloc(sizeof(SList));
	if (newnode == NULL)
	{
		printf("malloc fail");
		return false;
	}
	newnode->next = NULL;
	newnode->data = x;

	newnode->next = (*t);
	(*t) = newnode;
	return true;
}
bool is_empty(SList* t)
{
	if (t == NULL)
		return true;
	else
		return false;
}
bool STack_Pop(SList** t, int *data)
{
	SList* p = *t;
	if (is_empty(*t))
		return false;
	*data = (*t)->data;
	*t = p->next;
	free(p);
	return true;
}
void dec_otc(int n)
{
	if (n < 0)
	{
		printf("number is invaild");
		return;
	}
	SList* Pop = NULL;
	STackInit(&Pop);
	while (n != 0)
	{
		ST_Push(&Pop, n % 8);
		n = n / 8;
	}
	int data = 0;
	while (!is_empty(Pop))
	{
		STack_Pop(&Pop, &data);
		printf("%d", data);
	}

}
int main()
{
	int a = 0;
	scanf("%d", &a);
	dec_otc(a);
	return 0;
}